package com.xhdx;

public class WaitMinDoingTest {
    private static final int MAX_COUNT = 10;// 重试次数
    private static final long SLEEP = 8 * 1000;// 8s

    public static void main(String[] args) {
        int currentCount = 0;
        while (currentCount < MAX_COUNT) {
            boolean doFlag = doing(currentCount);
            if (!doFlag) {
                currentCount++;
                try {
                    Thread.sleep(SLEEP);
                } catch (InterruptedException e) {
                }
            } else
                break;
        }
    }

    /**
     * 
     * @return true 执行成功 false 未执行成功
     */
    public static boolean doing(int a) {
        System.out.print("......................" + a);
        if (a == 60) {
            System.out.print("--->成功");
            return true;
        }
        System.out.println("--->失败");
        return false;
    }

    // public static boolean isTimeOut(long txtime, long time){
    // Date now = new Date();
    // long intvMillSecond = now.getTime() - txtime;
    // return intvMillSecond > time;
    // }
    // public static boolean isTimeOut(String txtime, long time){
    // Date date = null;
    // try {
    // date =
    // DateUtil.getSimpleDateFormat(DateUtil.DATE_TIME_SHORT_PATTERN).parse(txtime);
    // } catch (Exception e) {
    // e.printStackTrace();
    // }
    // Date now = new Date();
    // long intvMillSecond = now.getTime() - date.getTime();
    // return intvMillSecond > time;
    // }
}
